<template>
	<view class="credit-result-component">
		<hsb-common-popup-header
			title="芝麻先享｜极速回收"
			@close="$emit('close')"
		/>
		<view class="credit-result-body">
			<view v-if="creditInfo.status === '3'" class="pass-body">
				<view class="h1-title">恭喜您通过信用评估</view>
				<view class="prices-body">
					<text>下单后立即预付</text>
					<text class="prices prepay">¥{{ preAmount }}</text>
					<text>质检后付尾款</text>
					<text class="prices final">¥{{ finalAmount }}</text>
				</view>
			</view>
			<view v-else class="no-pass-body">
				<view class="h1-title">芝麻先享｜极速回收服务开通失败，您可能存在未完结履约的信用服务，或芝麻信用额度未达要求。</view>
				<view class="h2-title">下单后顺丰上门取件，免费寄出，质检后24小时内付款，价格不满意包邮退回。</view>
			</view>
		</view>
		<view class="credit-prepay-footer">
			<view class="credit-prepay-btn" @click="$emit('close')">
				<text>我知道了</text>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		evInfo: Object,
		creditInfo: Object,
		discountInfo: Object
	},
	computed: {
		quotationValue () {
			return this.evInfo.quotation / 100 || 0
		},
		addConpouValue () {
			return this.discountInfo.addConpous?.couponMoney / 100 || 0
		},
		useConpouValue () {
			return this.discountInfo.useConpous?.couponsValue / 100 || 0
		},
		preAmount () {
			return this.creditInfo.preAmount / 100 || 0
		},
		finalAmount () {
			return this.total - this.preAmount
		},
		total () {
			return this.quotationValue + this.addConpouValue + this.useConpouValue
		}
	}
}
</script>

<style lang="scss" scoped>
@import './index.scss';
</style>